package com.howie.gulimall.product.feign;

import com.howie.common.to.SkuReductionTo;
import com.howie.common.to.SpuBoundsTo;
import com.howie.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @description: 远程调用 gulimall-coupon 服务
 * @author: laizhenghua
 * @date: 2021/1/15 18:28
 */
@FeignClient(name = "gulimall-coupon")
public interface CouponFeignService {
    /**
     调用远程服务，SpringCloud 传参问题：
        1、@RequestBody 将对象参数转化为json字符串
        2、在注册中心中找到 gulimall-coupon 服务，给服务对应的请求路径(/coupon/spubounds/save)发送请求
        3、将转化的json字符串放在请求体
        4、对方服务收到请求，请求体里有json数据
     */
    @PostMapping(path = "/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundsTo spuBoundsTo);
    @PostMapping(path = "coupon/skufullreduction/save_info")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
